/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: 14px;
}

/* 页面头部 */
.page-header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 主容器 */
.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto; /* auto 可以实现水平居中 */
    padding: 0 1rem;
    flex: 1; /* 占据剩余空间 */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 防止内容溢出 */
}

/* Tab导航 */
.tab-nav {
    display: flex;
    margin: 2rem 0;
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background: white;
    border-radius: 8px;
    cursor: pointer;
}

.tab-btn:first-child {
    margin-right: 10px;
}

.tab-btn.active {
    background: #6e8efb;
    color: white;
}

/* 搜索框样式 */
.search-section {
    margin-bottom: 2rem;
}

.search-wrapper {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 1rem 3rem 1rem 1rem;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #6e8efb;
}

.search-icon {
    position: absolute;
    right: 1rem;    
    top: 50%;
    transform: translateY(-50%);
    /* width: 20px; */
    /* height: 20px; */
    /* background: #6e8efb; */
    /* border-radius: 50%; */
    /* cursor: pointer; */
}

/* content属性一定要写 */
/* .search-icon::before {
    content: "";
    position: absolute;
    width: 10px;
    height: 2px;
    background: black;
    transform: rotate(45deg);
    bottom: -2px;
    right: -5px;
} */

/* 任务列表样式 */
.task-list {
    list-style: none;
}

.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.task-content {
    flex: 1;
}

.task-actions {
    display: flex;
}

.task-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.task-item h3 {
    color: #333;
    margin-bottom: 0.5rem;
}

.task-item p {
    color: #666;
    font-size: 0.9rem;
}

.task-item.completed {
    opacity: 0.8;
    background: #f8f8f8;
}

/* 操作按钮样式 */
.action-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.task-actions .action-btn:not(:last-child) {
    margin-right: 8px;
}

.complete-btn {
    background-color: #4CAF50;
    color: white;
}

.complete-btn:hover {
    background-color: #45a049;
}

.delete-btn {
    background-color: #ff4444;
    color: white;
}

.delete-btn:hover {
    background-color: #cc0000;
}

.btn-icon {
    font-size: 1.1rem;
    line-height: 1;
}

#todo .un-complete-btn, #done .complete-btn, #done .delete-btn {
    display: none;
}

#done .un-complete-btn {
    display: block;
}

/* Tab内容切换 */
.tab-content {
    display: none;
    flex: 1; /* 占据剩余空间 */
    overflow: auto;
    padding-right: 0.8rem;
}

.tab-content.active {
    display: block;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .page-header {
        height: 60px;
    }

    .tab-nav {
        flex-direction: column;
    }

    .task-item {
        flex-direction: column;
    }

    .task-actions {
        margin-top: 1rem;
        justify-content: flex-end;
    }

    .btn-text {
        display: none; /* 在移动端只显示图标 */
    }

    .action-btn {
        padding: 0.5rem;
    }
}

/* 页脚样式 */
.page-footer {
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    padding: 1.5rem 1rem;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
}

.footer-section {
    flex: 1;
}

.footer-section h4 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.footer-section a:hover {
    opacity: 0.8;
}

.footer-bottom {
    max-width: 800px;
    margin: 1rem auto 0;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 0.9rem;
}

.add-section {
    margin-bottom: 2rem;
}

.add-wrapper {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.add-input {
    width: 100%;
    padding: 1rem 3rem 1rem 1rem;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.add-input:focus {
    outline: none;
    border-color: #6e8efb;
}

.add-todo {
    margin-left: 0.2rem;
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    background-color: #0f9ee4;
    color: #fff;
    position: absolute;
    right: -8rem;
    top: 50%;
    transform: translateY(-50%);
}